/**
 * 
 */
package com.bodystm.temperature.web;

import java.util.Calendar;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.bodystm.temperature.patient.PatientBedDao;
import com.bodystm.temperature.patient.PatientBedService;
import com.bodystm.temperature.patient.PatientBedUser;
import com.bodystm.temperature.server.Temperature;
import com.bodystm.temperature.server.TemperatureService;

/**
 * @author rxz
 *
 */
public class ClearStatisticVar implements Runnable {
	@Override
	public void run() {
		TemperatureDevice temperatureDevice=null;
		Date dateTemp=null;
		Date dateCur=new Date();
		//Calendar calendar= Calendar.getInstance();
		for(int i=0;i<DeviceSettings.lstMacs.size();i++){
			temperatureDevice=(TemperatureDevice) DeviceSettings.hasDevice.get(DeviceSettings.lstMacs.get(i));
			dateTemp=temperatureDevice.getLastSavTime();
			if(dateTemp!=null&&((dateCur.getTime()-dateTemp.getTime()) / (1000 * 60 * 60 * 24)>=1)){
				DeviceSettings.hasDevice.remove(DeviceSettings.lstMacs.get(i));
				DeviceSettings.lstMacs.remove(i--);
			}
		}
	}

}
